using System;
using System.Collections.Generic;
using System.Linq;
using I2.Loc;
using UnityEngine;

public class DeathmatchGameMode : DefaultGameMode
{
	public override bool CanStartNow()
	{
		return GameController.instance.listPlayers.Count((PlayerBehavior p) => p.photonView.owner.GetValueByKey(PlayerPropsKeys.startPVP, false)) > 1;
	}

	public override void StartRound()
	{
		base.StartRound();
	}

	public override void RestartRound()
	{
		base.RestartRound();
	}

	public override TDMResult GetRoundResult()
	{
		return TDMResult.None;
	}

	public override List<PlayersInfoScroll.PlayerInfoPanelParams> GetPlayersList<T>(Func<T, bool> filter)
	{
		List<PlayersInfoScroll.PlayerInfoPanelParams> list = new List<PlayersInfoScroll.PlayerInfoPanelParams>();
		List<PlayerBehavior> list2 = GameController.instance.listPlayers;
		if (filter != null)
		{
			list2 = list2.Where((PlayerBehavior x) => filter(x as T)).ToList();
		}
		TeamExtensions.BubbleSort(list2, TeamExtensions.SortPlayersByPoints);
		int num = 0;
		foreach (PlayerBehavior item in list2)
		{
			PhotonPlayer owner = item.photonView.owner;
			Color magenta = Color.magenta;
			Color magenta2 = Color.magenta;
			if (PlayerBehavior.MyPlayer == item)
			{
				magenta = GameInfoWindow.instance.myPlayerBG;
				magenta2 = GameInfoWindow.instance.myPlayerText;
				PVPManager.instance.myPlace = num + 1;
			}
			else
			{
				magenta = new Color(24f / 85f, 0.38039216f, 0.4117647f, 1f);
				magenta2 = Color.white;
			}
			list.Add(new PlayersInfoScroll.PlayerInfoPanelParams());
			list[num].place = num + 1;
			list[num].name = owner.GetValueByKey(PlayerPropsKeys.nickname, "Empty name in Props").ToUpper();
			list[num].state1 = string.Empty;
			list[num].state2 = item.points.ToString();
			list[num].flagScore = 0;
			list[num].bgColor = magenta;
			list[num].textColor = magenta2;
			list[num].playerId = owner.GetValueByKey(PlayerPropsKeys.playerId, string.Empty);
			num++;
		}
		return list;
	}

	public override string EndGameModeTitle()
	{
		return ScriptLocalization.Get("Game_Common/coop_over");
	}

	public override PlayersScrollType TypeOfScrollForGameMode()
	{
		return PlayersScrollType.Deathmatch;
	}
}
